import { queryCleintMag, queryUpGrade} from '@/services/client/clientMag';
export default {
  namespace: 'clientMag',
  state: {
    // 列表数据
    data: {
      list: [],
      pageNum: 0,
      pageSize: 0,
      totalCount: 0,
    },
  },
  effects: {
    *queryList({ payload }, { call, put }) {
      const response = yield call(queryCleintMag, payload);
      yield put({
        type: 'save',
        payload: response,
      });
    },
    *upGrade({ payload, callback }, { call, put }) {
      const response = yield call(queryUpGrade, payload);
      yield put({
        type: 'saveupGrade',
        payload: response,
      });
      if (callback) callback(response);
    },
  },

  reducers: {
    save(state, action) {
      return {
        ...state,
        data: action.payload.data,
      };
    },
  },
};
